package io;

import java.io.*;

public class PWDemo2 {
    public static void main(String[] args) throws FileNotFoundException, UnsupportedEncodingException {
        //低级流 负责向文件中写入字节
        FileOutputStream fos=new FileOutputStream("pw2.txt");
        //转换流(高级流) 负责衔接字符与字节流,将写出的字节转换为字符
        OutputStreamWriter osw=new OutputStreamWriter(fos,"UTF-8");
        //缓冲流(高级流)   负责块写文本数据加速
        BufferedWriter bw=new BufferedWriter(osw);
        // pw(高级流)  按行写出字符串,自动行刷新
        PrintWriter pw=new PrintWriter(bw);

        pw.println("你好");
        pw.println("再见");
        System.out.println("输出完毕");
        pw.close();
    }
}
